package com.example.androidapp2;

import com.xyzdesa.droidnomy.R;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.Button;

public class PopUpRating extends Dialog {

	public Context Ctx;
	public DbAdapter Db;
	public Button btnRate;
	public Button btnRateTarde;	

	public PopUpRating(Context context, DbAdapter db ) {
		super(context);		
		Ctx = context;
		Db = db;
		this.setContentView(R.layout.pup_rating);

		this.setTitle(Ctx.getResources().getString(R.string.pupRating));
		btnRate = (Button) findViewById(R.id.btnRate);
		btnRateTarde = (Button) findViewById(R.id.btnRateTarde);		

		SetListeners();		
	}

	public void SetListeners()
	{
		btnRate.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Ctx.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=com.xyzdesa.droidnomy")));
				Db.SetAnsweredRating();
				hide();
			}
		});  

		btnRateTarde.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				hide();
			}
		});
	}
}
